#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define vec vector<int>
#define y1 y_____hahahaha_____1

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return x * sgn;}

const int N = 233333;
const int mod = 1e9 + 7;

int f[N],n,a[N],ind[N],ans;

int upd(int x){return x + (x >> 31 & mod);}

int main(){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; for(int i = 1;i <= n;i++) a[i] = in,ind[a[i]] = i;
	for(int i = n;i >= 1;i--){
		f[a[i]] = 1;
		for(int j = a[i] & (a[i] - 1);j;j = (j - 1) & a[i]) if(ind[j] && ind[j] > i) f[a[i]] = upd(f[a[i]] + f[j] - mod);
		ans = upd(ans + f[a[i]] - 1 - mod);
	}
	printf("%d\n",ans);
	return 0;
}
